clear; close all;


% event window
NOBS_before = 24;
NOBS_after  = 10*12;


% load projection output, Jan/1929--November/1936
leverage_1929 = xlsread('../data/projected_series.xlsx','B2:B96');
cds_1929      = xlsread('../data/projected_series.xlsx','C2:C96');
iv_1929       = xlsread('../data/projected_series.xlsx','D2:D96');


% load crisis simulation
load crisis_simulation_out.mat MOM1 MOM2 MOM3 MOM5


% load Seo-Wachter crisis simulation
load ../data/SW18_simulation
load ../data/W13_simulation


% Figure 1
ff = figure('Position', [100, 100, 800, 670]);
set(ff,'Units','Inches');
pos = get(ff,'Position');
set(ff,'PaperPositionMode','Auto','PaperUnits','Inches','PaperSize',[pos(3), pos(4)])
subplot = @(m,n,p)subtightplot(m, n, p, [0.10 0.10], [0.13 0.04], [0.04 0.01]);

subplot(2,2,1);
bar((-1:7)-0.5,[0,0,-4.27,-2.97,-8.06,-2.83,5.33,3.56,7.49],'r'); hold on;
plot((-12:84-1)/12,W13_delC_m,'b--','LineWidth',1.5);
grid on; set(gca,'FontSize',12); xlim([-1,7]); ylim([-24,9])
text(0.15,-15,'Wachter (2013)','FontSize',11,'Fontweight','bold','Color','b')
text(0.15,-17.5,'Seo, Wachter (2018)','FontSize',11,'Fontweight','bold','Color','b')
plot((-NOBS_before:NOBS_after-1)/12,12*mean(MOM1,2),'k:','LineWidth',1.5);
set(gca,'XTickLabel',[]);
title('Consumption Growth (% p.a.)','FontSize',15);

subplot(2,2,2);
plot((-12:7*12-2)/12,100*leverage_1929,'r','LineWidth',1.5); hold on;
plot((-NOBS_before:NOBS_after-1)/12,mean(MOM3,2),'k:','LineWidth',1.5);
hold off
grid on; set(gca,'FontSize',12); xlim([-1,7]); ylim([12,54])
title('Leverage (%)','FontSize',15);
set(gca,'XTickLabel',[]);
set(gca,'YTick',20:10:50);
leg=legend('Data','Model','Location','NE','Orientation','horizontal'); set(leg,'FontSize',13,'box','on');
leg.Position(1) = leg.Position(1) - 0.358;
leg.Position(2) = leg.Position(2) -0.905;

subplot(2,2,3);
plot((-12:7*12-2)/12,100*iv_1929,'r','LineWidth',1.5); hold on;
plot(W13_time,W13_ATM_IV,'b--','LineWidth',1.5);
plot((-NOBS_before:NOBS_after-1)/12,mean(MOM5,2),'k:','LineWidth',1.5);
hold off
grid on; set(gca,'FontSize',12); xlim([-1,7]); ylim([10,90])
set(gca,'YTick',20:20:80);
title('Equity Volatility (% p.a.)','FontSize',15);
xlabel('Event Time (Years)','FontSize',15);
text(1.7,15.2,'Wachter (2013)','FontSize',11,'Fontweight','bold','Color','b')

subplot(2,2,4);
plot((-12:7*12-2)/12,100*cds_1929,'r','LineWidth',1.5); hold on;
plot(-1:1/12:7,mean(MOM1_SW18,2),'b--','LineWidth',1.5);
plot((-NOBS_before:NOBS_after-1)/12,mean(MOM2,2),'k:','LineWidth',1.5);
hold off
grid on; set(gca,'FontSize',12); xlim([-1,7]); ylim([0,6])
set(gca,'YTick',0:2:6);
title('Credit Spread (%)','FontSize',15);
xlabel('Event Time (Years)','FontSize',15);
text(1.5,1.1,'Seo, Wachter (2018)','FontSize',11,'Fontweight','bold','Color','b')

print(gcf,'figure_1','-dpdf','-r0')


